package cn.drenal.helper;

import java.awt.*;

public class GuiHelper
{
    static Toolkit kit = Toolkit.getDefaultToolkit(); //Java提供的GUI默认工具类

    //将指定组件屏幕居中
    public static void setCenter(Component c)
    {
        int x = (kit.getScreenSize().width - c.getWidth()) / 2;
        int y = (kit.getScreenSize().height - c.getHeight()) / 2;
        c.setLocation(x, y);
    }
}
